package com.wx.activitys.drp;

import java.io.Serializable;

/**
 * 基本的回复对象
 */
public class JsonResult implements Serializable{

    private static final long serialVersionUID = -6677792087202796374L;
    private String code; //状态码
    private String msg;   //回复消息
    private Object data;       //数据对象


    /**
     * 默认成功的回复
     * @param msg 回复消息
     * @param data    回复的数据
     * @return
     */
    public static JsonResult success(String msg,Object data){
        return new JsonResult("200",msg,data);
    }

    /**
     * 默认失败的回复
     * @param msg 回复消息
     * @param data 回复的数据
     * @return
     */
    public static JsonResult exception(String msg){
        return new JsonResult(msg);
    }
	/**
	 * 默认失败的回复
	 * @param msg 回复消息
	 * @param data 回复的数据
	 * @return
	 */
	public static JsonResult fail(String msg,Object data){
		return new JsonResult("500",msg,data);
	}

    public JsonResult(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public JsonResult( String msg) {
        this.msg = msg;
    }

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
    
}
